import Vue from 'vue'
import App from './App.vue'
import router from './router'

import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';

import VXETable from 'vxe-table'
import 'vxe-table/lib/style.css'


import VXETablePluginExportXLSX from 'vxe-table-plugin-export-xlsx'


// 全局公用css
import '@/assets/css/globals.css'

// 请求配置
import axios from 'axios'
// api----------
import ErpBaseApi from './api/ErpBaseApi.js'
import BaseApi from './api/BaseApi.js'

// 过滤器
import ErpFilter from './filter/ErpBsFilter.js'
import BsFilter from './filter/BsFilter.js'

import baseUrl from './constant/Config.js'
import './lib/directives.js'
import './lib/preventReClick.js'
import JsonExcel from "vue-json-excel";
import 'animate.css';

import echarts from "echarts";
// 右击菜单
import VueContextMenu from 'vue-contextmenu'
import vueSeamlessScroll from 'vue-seamless-scroll' // 循环滚动

import {hiPrintPlugin} from 'vue-plugin-hiprint'
hiPrintPlugin.disAutoConnect(); // 取消自动连接直接打印客户端
Vue.use(vueSeamlessScroll)
// 系统常用注册

Vue.use(ErpBaseApi)
Vue.use(ErpFilter)

// 程序插件注册
Vue.use(BaseApi)
Vue.use(BsFilter)

Vue.use(VXETable)

Vue.use(ElementUI)
Vue.use(VueContextMenu)
VXETable.use(VXETablePluginExportXLSX);
Vue.component("downloadExcel", JsonExcel)
    // 配置请求根路径
// axios.defaults.baseURL = 'http://192.168.1.11:8811/'
// axios.defaults.baseURL = 'http://192.168.1.139:8811/'
// axios.defaults.baseURL = baseUrl.globalUrl
if (process.env.NODE_ENV === "production") {
    console.log("进来了");
    // axios.defaults.baseURL = window.location.host;
    axios.defaults.baseURL = '/';
    // axios.defaults.baseURL = "http://8.134.93.27:5000/";
  } else {
    axios.defaults.baseURL = baseUrl.globalUrl;
  }
  console.log("当前地址为：" + baseUrl.globalUrl);
// axios.defaults.baseURL = 'http://192.168.1.188:8811/'
    // axios.defaults.baseURL = 'http://192.168.1.139:8811/'
    // 添加请求拦截器，为请求添加头部的Authorization参数
axios.interceptors.request.use(config => {
    // 可以通过打印config，打印出请求里面的全部信息
    // 这里是为请求头添加Authorization参数，并且设置值为token
    config.headers.token = window.sessionStorage.getItem('token')
    return config
})

Vue.prototype.$axios = axios
Vue.prototype.$echarts = echarts;

// Vue.config.productionTip = false

new Vue({
    router,
    render: h => h(App)
}).$mount('#app')